<?php
/**
 * Created by jinqiang on 2024/6/24 14:17.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Controllers\Log;


use App\Http\Controllers\Controller;
use App\Http\Services\Log\LogService;
use Illuminate\Http\Request;

class LogController extends Controller
{
    //操作日志
    public function list(Request $request, LogService $logService)
    {
        $this->validate($request, [
            'page' => 'required',
            'limit' => 'required'
        ]);
        $param = $request->all();
        $res = $logService->search($param);
        return result($res);
    }

    //金蝶推送日志
    public function kingdeeList(Request $request, LogService $logService)
    {
        $this->validate($request, [
            'page' => 'required',
            'limit' => 'required'
        ]);
        $param = $request->all();
        $res = $logService->searchKingdee($param);
        return result($res);
    }

    //领猫推送日志
    public function lmList(Request $request, LogService $logService)
    {
        $this->validate($request, [
            'page' => 'required',
            'limit' => 'required'
        ]);
        $param = $request->all();
        $res = $logService->searchLm($param);
        return result($res);
    }

    //领猫推送
    public function lmPush(Request $request, LogService $logService)
    {
        $this->validate($request, [
            'id' => 'required',
        ]);
        $param = $request->all();
        $res = $logService->pushLm((Int)$param['id']);
        return $res['code'] === 0 ? success("操作成功") : error($res['msg'], $res);
    }
}
